package com.situ.firmadmin.util;

import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class JSONUtil {
    private JSONUtil(){

    }
    public static void toJSON(HttpServletResponse resp, Object obj) {

        resp.setContentType("text/html;charset=utf-8");
        ObjectMapper mapper=new ObjectMapper();
        try {
            mapper.writeValue(resp.getWriter(),obj);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

